const Sequelize = require('sequelize')
const {dbName,host,password,port,user} = require('../config/config').database
const sequelize = new Sequelize(dbName,password,user,{
    dialect:'mysql',
    host,
    port,
    logging:true,
    timezone:'+08:00',
    dialectOptions: {
        dateStrings: true,
        typeCast: true
    },
    define:{
        timestamps:true,
        paranoid:true,
        createdAt:'created_at',
        updatedAt:'updated_at',
        deletedAt:'deleted_at',
        underscored:true
    }
})
sequelize.sync({
    force:false
})
module.exports = {
    db:sequelize
}